<?php
class registerController extends Controller{
    
    private $svc=null;
    
    public function __construct(){
        parent::__construct();
        $this->svc=load_service('member');
    }
    //检测是否已经登陆
    public function c(){
        $l=load_service('i_member_login');
        if($l->user_session('ISLOGIN')){
            alert('登陆状态无法进行注册！');
            jump('index','index');
       }
    }
    //展示注册界面
    public function register(){
        $this->c();
        include($this->viewer_dir.'register/register.php');
    }
    //注册提交
    public function register_(){
        $this->c();
        if($_POST){
            $r=$this->svc->add_($_POST);
            if($r[0]){
                alert('注册成功！');
                jump('index','index');
            }else{
                alert($r[1]);
                back();
            }
        }
    }
    
}